package m.jclecai.com.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

import m.jclecai.com.R;


public class BFDialog extends Dialog implements OnClickListener {
	private Button confirmBtn, cancleBtn;
	private Context context;
	private BFDialogListener listener;
	private View customView;

	/**
	 * 
	 * @category 回调接口
	 * 
	 */
	public interface BFDialogListener {
		public void onClick(View view);
	}

	public BFDialog(Context context) {
		super(context);
		// TODO Auto-generated constructor stub
		this.context = context;
	}

	public BFDialog(Context context, int theme) {
		super(context, theme);
		// TODO Auto-generated constructor stub
		this.context = context;
	}

	public BFDialog(Context context, int theme, BFDialogListener listener) {
		super(context, theme);
		// TODO Auto-generated constructor stub
		this.context = context;
		this.listener = listener;
		LayoutInflater inflater = LayoutInflater.from(context);
		customView = inflater.inflate(R.layout.dialog_add_bf, null);
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		initView();
	}

	private void initView() {
		// TODO Auto-generated method stub
		setContentView(customView);
		confirmBtn = (Button) getCustomView().findViewById(R.id.dialog_confirm);
		cancleBtn = (Button) getCustomView().findViewById(R.id.dialog_cancel);

		TextView txt10 = (TextView) getCustomView().findViewById(
				R.id.jczq_bf_10);
		TextView txt20 = (TextView) getCustomView().findViewById(
				R.id.jczq_bf_20);
		TextView txt21 = (TextView) getCustomView().findViewById(
				R.id.jczq_bf_21);
		TextView txt30 = (TextView) getCustomView().findViewById(
				R.id.jczq_bf_30);
		TextView txt31 = (TextView) getCustomView().findViewById(
				R.id.jczq_bf_31);
		TextView txt32 = (TextView) getCustomView().findViewById(
				R.id.jczq_bf_32);
		TextView txt40 = (TextView) getCustomView().findViewById(
				R.id.jczq_bf_40);
		TextView txt41 = (TextView) getCustomView().findViewById(
				R.id.jczq_bf_41);
		TextView txt42 = (TextView) getCustomView().findViewById(
				R.id.jczq_bf_42);
		TextView txt50 = (TextView) getCustomView().findViewById(
				R.id.jczq_bf_50);
		TextView txt51 = (TextView) getCustomView().findViewById(
				R.id.jczq_bf_51);
		TextView txt52 = (TextView) getCustomView().findViewById(
				R.id.jczq_bf_52);
		TextView txt3 = (TextView) getCustomView().findViewById(
				R.id.jczq_bf_s_other);

		TextView txt00 = (TextView) getCustomView().findViewById(
				R.id.jczq_bf_00);
		TextView txt11 = (TextView) getCustomView().findViewById(
				R.id.jczq_bf_11);
		TextView txt22 = (TextView) getCustomView().findViewById(
				R.id.jczq_bf_22);
		TextView txt33 = (TextView) getCustomView().findViewById(
				R.id.jczq_bf_33);
		TextView txt1 = (TextView) getCustomView().findViewById(
				R.id.jczq_bf_p_other);

		TextView txt01 = (TextView) getCustomView().findViewById(
				R.id.jczq_bf_01);
		TextView txt02 = (TextView) getCustomView().findViewById(
				R.id.jczq_bf_02);
		TextView txt12 = (TextView) getCustomView().findViewById(
				R.id.jczq_bf_12);
		TextView txt03 = (TextView) getCustomView().findViewById(
				R.id.jczq_bf_03);
		TextView txt13 = (TextView) getCustomView().findViewById(
				R.id.jczq_bf_13);
		TextView txt23 = (TextView) getCustomView().findViewById(
				R.id.jczq_bf_23);
		TextView txt04 = (TextView) getCustomView().findViewById(
				R.id.jczq_bf_04);
		TextView txt14 = (TextView) getCustomView().findViewById(
				R.id.jczq_bf_14);
		TextView txt24 = (TextView) getCustomView().findViewById(
				R.id.jczq_bf_24);
		TextView txt05 = (TextView) getCustomView().findViewById(
				R.id.jczq_bf_05);
		TextView txt15 = (TextView) getCustomView().findViewById(
				R.id.jczq_bf_15);
		TextView txt25 = (TextView) getCustomView().findViewById(
				R.id.jczq_bf_25);
		TextView txt0 = (TextView) getCustomView().findViewById(
				R.id.jczq_bf_f_other);

		txt10.setOnClickListener(this);
		txt20.setOnClickListener(this);
		txt21.setOnClickListener(this);
		txt30.setOnClickListener(this);
		txt31.setOnClickListener(this);
		txt32.setOnClickListener(this);
		txt40.setOnClickListener(this);
		txt42.setOnClickListener(this);
		txt41.setOnClickListener(this);
		txt50.setOnClickListener(this);
		txt51.setOnClickListener(this);
		txt52.setOnClickListener(this);
		txt3.setOnClickListener(this);

		txt00.setOnClickListener(this);
		txt11.setOnClickListener(this);
		txt22.setOnClickListener(this);
		txt33.setOnClickListener(this);
		txt1.setOnClickListener(this);

		txt01.setOnClickListener(this);
		txt02.setOnClickListener(this);
		txt12.setOnClickListener(this);
		txt03.setOnClickListener(this);
		txt13.setOnClickListener(this);
		txt23.setOnClickListener(this);
		txt04.setOnClickListener(this);
		txt14.setOnClickListener(this);
		txt24.setOnClickListener(this);
		txt05.setOnClickListener(this);
		txt15.setOnClickListener(this);
		txt25.setOnClickListener(this);
		txt0.setOnClickListener(this);
		confirmBtn.setOnClickListener(this);
		cancleBtn.setOnClickListener(this);
	}

	@Override
	public void onClick(View arg0) {
		listener.onClick(arg0);
	}

	@Override
	public View findViewById(int id) {
		return super.findViewById(id);
	}

	public View getCustomView() {
		return customView;
	}
}
